package top.zuli.package01.class13;

public class ThreadDemo4 {
    public static void main(String[] args) {
        new Thread(){
            @Override
            public void run() {
                for(int i=1;i<=100;i++){
                    if(i%2==0){
                        try {
                            sleep(100);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        System.out.println(getName()+":"+i);
                    }
                }
            }
        }.start();
        new Thread(){
            @Override
            public void run() {
                for(int i=1;i<=100;i++){
                    if(i%2!=0){
                        try {
                            sleep(100);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        System.out.println(getName()+":"+i);
                    }
                }
            }
        }.start();
    }
}